<template>
	<view>
		<el-menu :default-active="actvitiTag" class="padding-top" @open="handleOpen" @close="handleClose">
			<el-menu-item index="user" @click="gotoPages('/pages/index/home')">
				<i class="el-icon-user"></i>
				<span slot="title" :class="actvitiTag == 'user' ? 'text-bold':''" >
					我的医学题库
				</span>
			</el-menu-item>
			
			<el-menu-item index="answer" @click="gotoPages('/pages/qbms/answerList')">
				<i class="el-icon-edit"></i>
				<span slot="title" :class="actvitiTag == 'answer' ? 'text-bold':''">
					我的答题
					<span class="padding-left-lg fr">{{navData.answerNum}} </span>
				</span>
			</el-menu-item>
			
			<el-menu-item index="note" @click="gotoPages('/pages/qbms/noteList')">
				<i class="el-icon-notebook-1"></i>
				<span slot="title" :class="actvitiTag == 'note' ? 'text-bold':''">我的笔记
					<span class="padding-left-lg fr">{{navData.noteNum}} </span>
				</span>
			</el-menu-item>
			
			<el-menu-item index="favorite" @click="gotoPages('/pages/qbms/favoriteList')">
				<i class="el-icon-star-off"></i>
				<span slot="title" :class="actvitiTag == 'favorite' ? 'text-bold':''">习题收藏
					<span class="padding-left-lg fr">{{navData.favoriteNum}} </span>
				</span>
			</el-menu-item>
			<el-menu-item index="mistake" @click="gotoPages('/pages/qbms/mistakeList')">
				<i class="el-icon-folder-delete"></i>
				<span slot="title" :class="actvitiTag == 'mistake' ? 'text-bold':''">错题集
					<span class="padding-left-lg fr">{{navData.mistakeNum}} </span>
				</span>
			</el-menu-item>

		</el-menu>
	</view>
</template>

<script>
	import {
		qbmsNavData
	} from "@/api/qbms.js"

	export default {
		name: "MySideBar",
		data() {
			return {
				navData: {},
			};
		},
		props: {
			actvitiTag: {
				type: String,
				default: "user",
		
			},
		},
		mounted() {
			this.getQbmsNavData();
		},
		watch: {
			// actvitiTag: (newVlaue, oldValue) => {
			// 	console.log(newVlaue);
			// }
		},
		methods: {
			/** 获取导航数据 */
			getQbmsNavData() {
				qbmsNavData({}).then(res => {
					this.navData = res.data;
				})
			},

			/** 跳转页面 */
			gotoPages(url) {
				uni.navigateTo({
					url: url
				})
			}

		}


	}
</script>

<style>

</style>
